<%@ page import="java.util.ArrayList" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
    <title>图书列表</title>
</head>
<body>
<%
    if (request.getSession().getAttribute("modBook_message") != null) {
        out.print("<script>alert(\"" + (request.getSession().getAttribute("modBook_message")) + "\");</script>"); // 弹窗提示
        request.getSession().removeAttribute("modBook_message"); // 删除会话
    }
%>
<a href="${pageContext.request.contextPath}/admin/index.jsp">返回主页</a>
<form method="post" id="form1" name="form1" action="${pageContext.request.contextPath}/admin/deal/book_search.jsp">
    <table>
        <tr>
            <td colspan="2">
                <label>查询</label>
            </td>
        </tr>
    </table>
    <label>书名：<input type="text" name="name"/></label><br>
    <input type="submit" value="查询">
</form>
<%
    ArrayList bookList = (ArrayList) request.getAttribute("bookList");
    if (bookList != null && bookList.size() > 0) {
%>
<table border="1" cellspacing="0px" cellpadding="5px" width="1400px">
    <tr>
        <th>ID</th>
        <th>书名</th>
        <th>价格</th>
        <th>简介</th>
        <th>出版社</th>
        <th>操作</th>
    </tr>
    <c:forEach items="${requestScope.bookList}" var="bookList">
        <tr>
            <td>${bookList.id}</td>
            <td>${bookList.name}</td>
            <td>${bookList.price}</td>
            <td>${bookList.desc}</td>
            <td>${bookList.publish}</td>
            <td>
                <a href="<c:url value="/admin/AdminBook?method=getBook&id=${bookList.id}"/>">修改</a>
                <a href="<c:url value="/admin/AdminBook?method=delBook&id=${bookList.id}"/>">删除</a>
            </td>
        </tr>
    </c:forEach>
</table>
<%
    }
%>
</body>
</html>